from presenter import basepresenter

class ArticlePresenter(basepresenter.BasePresenter):

    def respondToGet(self):
        #get the articles
        if (self.request.get('key')):
            viewarticle = self.articletask.getByKey(self.request.get('key'))
        else:
            pathtosearch = self.request.path[10:]
            viewarticle = self.articletask.getByTitlePath(pathtosearch)[0]
        self.template_values['viewarticle'] = viewarticle
        # set up the page title
        page_title = self.sitetitle + ' - ' + viewarticle.title
        self.template_values['page_title'] = page_title
        self.view.showGetResponse(self.template_values)